<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
    <title>计数器</title>
    <link rel="stylesheet" href="./css/index.css"/>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
<!-- html结构 -->
<div id="app">
    <!-- 计数器功能区域 -->
    <div class="input-num">
        <button @click="sub()">
            -
        </button>
        <span v-text="number"></span>
        <button @click="add()">
            +
        </button>
    </div>
    <img src="http://www.itheima.com/images/logo.png" alt=""/>
</div>
<!-- 编码 -->
<script>
    var app = new Vue({
        el:"#app",
        data:{
            number:1
        },
        methods:{
            add:function () {
                this.number++;
            },
            sub:function () {
                this.number--;
            }
        }
    });
</script>
</body>

</html>